snapshot: Set blend mode directly after pushing state
authorTimm Bäder <mail@baedert.org>
Sun, 8 Oct 2017 06:28:35 +0000 (08:28 +0200)
committerTimm Bäder <mail@baedert.org>
Sun, 8 Oct 2017 06:28:35 +0000 (08:28 +0200)
This is important since _push_state returns a pointer into a GArray
which could be invalidated and point to garbage after the subsequent
push_state call.

gtk/gtksnapshot.c

index a9a428db9f961d36261eafa15c1cd0f36978f56c..5d2a7f18f6de21ea48b3ff38cc845411996a8c04 100644 (file)
@@ -823,6 +823,7 @@ gtk_snapshot_push_blend (GtkSnapshot  *snapshot,
                                        current_state->translate_x,
                                        current_state->translate_y,
                                        gtk_snapshot_collect_blend_top);
+  top_state->data.blend.blend_mode = blend_mode;
 
   gtk_snapshot_push_state (snapshot,
                            g_strdup (str),
@@ -830,7 +831,6 @@ gtk_snapshot_push_blend (GtkSnapshot  *snapshot,
                            top_state->translate_x,
                            top_state->translate_y,
                            gtk_snapshot_collect_blend_bottom);
-  top_state->data.blend.blend_mode = blend_mode;
 }
 
 static GskRenderNode *